        PROGRAM ISTQT
 
        INTEGER SRCPTH(134),CMTPTH(134),TKNPTH(134),
     +          CIPTH(134),TMPPTH(134),OPTSTR(134),I,STATUS,
     +          IODSRC,IODTKN,IODCMT,IODTMP,TOKNUM,IODCI,NERROR,NWARN
 
        INTEGER TMPFIL
 
        INTEGER YPARSE,GETARG,OPEN,CREATE,ZYINCI,ZTKPTI
        EXTERNAL YPARSE,ZINIT,ZMESS,REMARK,ZQUIT,GETARG,OPEN,CREATE,
     +           ZCHOUT,ZPTINT,PUTCH,REMOVE,SEEK,ZYINCI,ZTKPTI
 
        DATA (TMPPTH(I),I=1,11)/108,121,112,99,109,116,46,
     +116,109,112,129/,
     +       (CIPTH(I),I=1,11)/108,121,112,99,109,105,46,
     +116,109,112,129/
 
        CALL ZINIT
        CALL INISTR
        CALL INISYM
        CALL INITRE
 
        IF (GETARG(1,SRCPTH,81).EQ.-100) CALL NAMES(1,SRCPTH)
        IF (GETARG(2,TKNPTH,81).EQ.-100) CALL NAMES(2,TKNPTH)
        IF (GETARG(3,CMTPTH,81).EQ.-100) CALL NAMES(3,CMTPTH)
        IF (GETARG(4,OPTSTR,81).EQ.-100) CALL NAMES(4,OPTSTR)
 
        IODSRC=OPEN(SRCPTH,0)
        IF (IODSRC.EQ.-1) CALL ERROR('Source File Open Failed')
        IODTKN=CREATE(TKNPTH,1)
        IF (IODTKN.EQ.-1) CALL ERROR('Token Stream Create Failed')
        IODCMT=CREATE(CMTPTH,1)
        IF (IODCMT.EQ.-1) CALL ERROR('Comment File Create Failed')
 
        IODTMP=TMPFIL(TMPPTH)
        IODCI=TMPFIL(CIPTH)
        IF (IODTMP.EQ.-1 .OR. IODCI.EQ.-1)
     +      CALL ERROR('Scratch File Creation Failed')
 
        IF (YPARSE(IODSRC,IODTMP,-1,IODCI,NERROR,NWARN).EQ.0) THEN
            IF (NERROR.GT.0) THEN
                CALL ZCHOUT('[ISTQT Terminated, ',2)
                CALL ZPTINT(NERROR,1,2)
                CALL ZCHOUT(' er'//'ror',2)
                IF (NERROR.GT.1) CALL PUTCH(115,2)
                CALL ZMESS(']',2)
                STATUS=-1
            ELSE
                CALL SEEK(0,IODCI)
                CALL SEEK(0,IODTMP)
                IF (ZYINCI(IODCI).EQ.-1) CALL ERROR(
     +              'Internal Error: Couldn''t reread comment index')
                CALL PT(OPTSTR,IODTMP,ZTKPTI(1,IODTKN,IODCMT),NERROR,
     +                  NWARN)
                IF (NERROR+NWARN.EQ.0) THEN
                    CALL REMARK('[ISTQT Normal Termination]')
                    STATUS=-2
                ELSE IF (NERROR.EQ.0) THEN
                    CALL ZCHOUT('[ISTQT Terminated, ',2)
                    CALL ZPTINT(NWARN,1,2)
                    CALL ZCHOUT(' war'//'ning',2)
                    IF (NWARN.GT.1) CALL PUTCH(115,2)
                    CALL ZMESS(']',2)
                    STATUS=-1002
                ELSE
                    CALL ZCHOUT('[ISTQT Terminated, ',2)
                    CALL ZPTINT(NERROR,1,2)
                    CALL ZCHOUT(' er'//'ror',2)
                    IF (NERROR.GT.1) CALL PUTCH(115,2)
                    CALL ZMESS(']',2)
                    STATUS=-1
                END IF
            END IF
        ELSE
            CALL REMARK('[ISTQT Fatal Error -- Terminated]')
            STATUS=-1001
        END IF
 
        CALL CLOSE(IODTMP)
        CALL CLOSE(IODCI)
        CALL REMOVE(TMPPTH)
        CALL REMOVE(CIPTH)
 
        CALL ZQUIT(STATUS)
 
        END
C ----------------------------------------------------------------------
C
C       N A M E S   -   Input the pathname of a required file from stdin
C
 
        SUBROUTINE NAMES(NUMBER,PATH)
        INTEGER NUMBER,PATH(*)
 
        INTEGER JUNK,PROMPT(22,4)
 
        SAVE PROMPT
 
        INTEGER ZGTCMD
        EXTERNAL ZGTCMD,ZPRMPT
 
C "Input source file: "
C "Output token stream: "
C "Output comment file: "
C "Options: "
 
        DATA (PROMPT(I,1),I=1,20)/73,110,112,117,116,32,115,
     +111,117,114,99,101,32,102,105,108,101,58,
     +32,129/,
     +       (PROMPT(I,2),I=1,22)/79,117,116,112,117,116,32,
     +116,111,107,101,110,32,115,116,114,101,97,109,
     +58,32,129/,
     +       (PROMPT(I,3),I=1,22)/79,117,116,112,117,116,32,
     +99,111,109,109,101,110,116,32,102,105,108,101,
     +58,32,129/,
     +       (PROMPT(I,4),I=1,10)/79,112,116,105,111,110,115,
     +58,32,129/
 
        CALL ZPRMPT(PROMPT(1,NUMBER))
        JUNK=ZGTCMD(PATH,0)
        RETURN
 
        END
C ----------------------------------------------------------------------
C
C       T M P F I L   -   Create a temporary file
C
 
        INTEGER FUNCTION TMPFIL(PATH)
        INTEGER PATH(81)
 
        INTEGER TMPNUM
 
        INTEGER CREATE
        EXTERNAL CREATE,ZITOCP
 
        TMPFIL=CREATE(PATH,2)
        IF (TMPFIL.NE.-1) RETURN
 100    CALL ZITOCP(TMPNUM,PATH(4),3,48)
        PATH(7)=46
        TMPFIL=CREATE(PATH,2)
        IF (TMPFIL.EQ.-1 .AND. TMPNUM.LT.999) THEN
            TMPNUM=TMPNUM+1
            GOTO 100
        ELSE IF (TMPNUM.EQ.999) THEN
            CALL ERROR('Can''t create temporary scratch file')
        END IF
 
        END
